using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ConversionTools._Excel
{
    /// <summary>
    /// <para>Excel To Table</para>
    /// <para>Converts Microsoft Excel files into a table.</para>
    /// <para>将 Microsoft Excel 文件转换为表格。</para>
    /// </summary>    
    [DisplayName("Excel To Table")]
    public class ExcelToTable : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ExcelToTable()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_Input_Excel_File">
        /// <para>Input Excel File</para>
        /// <para>The Microsoft Excel file to convert.</para>
        /// <para>要转换的 Microsoft Excel 文件。</para>
        /// </param>
        /// <param name="_Output_Table">
        /// <para>Output Table</para>
        /// <para>The output table.</para>
        /// <para>输出表。</para>
        /// </param>
        public ExcelToTable(object _Input_Excel_File, object _Output_Table)
        {
            this._Input_Excel_File = _Input_Excel_File;
            this._Output_Table = _Output_Table;
        }
        public override string ToolboxName => "Conversion Tools";

        public override string ToolName => "Excel To Table";

        public override string CallName => "conversion.ExcelToTable";

        public override List<string> AcceptEnvironments => ["configKeyword", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_Input_Excel_File, _Output_Table, _Sheet, _field_names_row, _cell_range];

        /// <summary>
        /// <para>Input Excel File</para>
        /// <para>The Microsoft Excel file to convert.</para>
        /// <para>要转换的 Microsoft Excel 文件。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Excel File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_Excel_File { get; set; }


        /// <summary>
        /// <para>Output Table</para>
        /// <para>The output table.</para>
        /// <para>输出表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Output_Table { get; set; }


        /// <summary>
        /// <para>Sheet</para>
        /// <para>The name of the particular sheet in the Excel file to import. If unspecified, the first sheet in the workbook will be used.</para>
        /// <para>要导入的 Excel 文件中特定工作表的名称。如果未指定，则将使用工作簿中的第一个工作表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Sheet")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Sheet { get; set; } = null;


        /// <summary>
        /// <para>Row To Use As Field Names</para>
        /// <para><xdoc>
        ///   <para>The row in the Excel sheet that contains values to be used as field names. The default value is 1.</para>
        ///   <para>The row specified will be skipped when converting records to the output table.</para>
        ///   <para>To avoid using any row's values as field names, set this parameter to 0, which will name the output fields using the column letter (for example, COL_A, COL_B, COL_C).</para>
        ///   <para>If a cell in a particular column is empty, the output field name will be based on the column letter. For example, if the input has three columns, and the row contains "city", "", and "country" in columns A, B, and C respectively, the output table's field names will be: city, COL_B, and country.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>Excel 工作表中包含要用作字段名称的值的行。默认值为 1。</para>
        ///   <para>将记录转换为输出表时，将跳过指定的行。</para>
        ///   <para>若要避免使用任何行的值作为字段名称，请将此参数设置为 0，这将使用列字母（例如，COL_A、COL_B、COL_C）命名输出字段。</para>
        ///   <para>如果特定列中的单元格为空，则输出字段名称将基于列字母。例如，如果输入有三列，并且该行分别在 A、B 和 C 列中包含“city”、“”和“country”，则输出表的字段名称将为：city、COL_B 和 country。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Row To Use As Field Names")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _field_names_row { get; set; } = 1;


        /// <summary>
        /// <para>Cell Range</para>
        /// <para><xdoc>
        ///   <para>The cell range to include.</para>
        ///   <para>A cell is the intersection of a row and a column. Columns are identified by letters (A, B, C, D), and rows are identified by numbers (1, 2, 3, 4). Each cell has an address based on its column and row. For example, the cell B9 is the intersection of column B and row 9.</para>
        ///   <para>A cell range defines a rectangle using the upper left cell and lower right cell, separated by a colon (:). Cell ranges are inclusive, so a range of A2:C10 will include all values in column A through C and all values in rows 2 through 10.</para>
        ///   <para>The output field names are derived from cell values in row 1, regardless of the rows specified in the cell range. For example, if the cell range specified is B2:D10, the field names will be based on the values in cells B1, C1, and D1.</para>
        ///   <para>The following are examples of valid cell ranges:
        ///   <bulletList>
        ///     <bullet_item>A2:C10—The values in columns A through C, from row 2 through 10.  </bullet_item><para/>
        ///     <bullet_item>B3:B40—The values in column B, from rows 3 through 40.  </bullet_item><para/>
        ///     <bullet_item>D5:X5—The values in columns D through X, for row 5.  </bullet_item><para/>
        ///     <bullet_item>E200:ALM20000—The values in column E through ALM (1000th column), from row 200 through 20000.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>The following are examples of invalid cell ranges:
        ///   <bulletList>
        ///     <bullet_item>A20:C10—The first cell cannot be lower (have a larger row number) than the second cell.  </bullet_item><para/>
        ///     <bullet_item>Z3:B5—The second cell cannot be to the right (have a larger column letter) of the second cell.  </bullet_item><para/>
        ///     <bullet_item>A5:G—Both cells must have a valid cell identifier: a letter and a number.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要包含的单元格范围。</para>
        ///   <para>单元格是行和列的交集。列用字母 （A、B、C、D） 标识，行用数字 （1、2、3、4） 标识。每个单元格都有一个基于其列和行的地址。例如，单元格 B9 是 B 列和第 9 行的交集。</para>
        ///   <para>单元格区域使用左上单元格和右下单元格定义矩形，用冒号 （:).单元格范围是包括在内的，因此 A2：C10 范围将包括 A 到 C 列中的所有值以及第 2 行到第 10 行中的所有值。</para>
        ///   <para>输出字段名称派生自第 1 行中的单元格值，而不考虑单元格区域中指定的行。例如，如果指定的单元格范围为 B2：D10，则字段名称将基于单元格 B1、C1 和 D1 中的值。</para>
        /// <para>以下是有效单元格区域的示例：
        ///   <bulletList>
        ///     <bullet_item>A2：C10 - 从第 2 行到第 10 行的 A 到 C 列中的值。</bullet_item><para/>
        ///     <bullet_item>B3：B40 - B 列中从第 3 行到第 40 行的值。</bullet_item><para/>
        ///     <bullet_item>D5：X5 - 第 5 行的 D 到 X 列中的值。</bullet_item><para/>
        ///     <bullet_item>E200：ALM20000 - 从第 200 行到 20000 行的 E 列到 ALM（第 1000 列）中的值。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// <para>以下是无效单元格区域的示例：
        ///   <bulletList>
        ///     <bullet_item>A20：C10 - 第一个单元格不能低于第二个单元格（行号更大）。</bullet_item><para/>
        ///     <bullet_item>Z3：B5 - 第二个单元格不能位于第二个单元格的右侧（具有较大的列字母）。</bullet_item><para/>
        ///     <bullet_item>A5：G - 两个单元格都必须具有有效的单元格标识符：一个字母和一个数字。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cell Range")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _cell_range { get; set; } = null;


        public ExcelToTable SetEnv(object configKeyword = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(configKeyword: configKeyword, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}